<?xml version="1.0" encoding="UTF-8" ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
			    xmlns:ui="http://java.sun.com/jsf/facelets"
			    xmlns:h="http://java.sun.com/jsf/html"
			    xmlns:f="http://java.sun.com/jsf/core"
			    xmlns:sec="http://www.condominioceleste.com/security/facelets/tags"    
			    template="./template/template_login.xhtml">
    
    <ui:define name="title">
        Registrar Ingreso
    </ui:define>
    
    <ui:define name="content">    				
			<h:outputScript library="js" name="analytics.js" target="head" />
    		<h:form id="agregarIngresoForm">
    			<f:event listener="#{receiptsBean.fillDropDownsInsertPage}" type="preRenderView" />	    					
				<h:panelGrid  cellspacing="1" border="0" 
							  bgcolor="#CCCCC0" columns="2" columnClasses="etiqueta,etiqueta_campo"							  
							  headerClass="titulocolumna" footerClass="columnadatoPar">
					
					<f:event listener="#{receiptsBean.validateReceiptsForm}" type="postValidate" />					
					<f:facet name="header">
						<h:outputText value="Agregar nuevo Ingreso" />  
					 </f:facet>		  							  							
					
					<h:outputText value="Mes a pagar:" />
					<h:panelGroup>						
						<h:panelGroup>
							<h:selectOneMenu id="mesId" value="#{receiptsBean.receiptMonth}"  styleClass="campo_texto" >
								<f:ajax render="@none" execute="@this" />
		                        <f:selectItem itemValue="1" itemLabel="Enero" />
		                        <f:selectItem itemValue="2" itemLabel="Febrero" />
		                        <f:selectItem itemValue="3" itemLabel="Marzo" />
		                        <f:selectItem itemValue="4" itemLabel="Abril" />
		                        <f:selectItem itemValue="5" itemLabel="Mayo" />
		                        <f:selectItem itemValue="6" itemLabel="Junio" />
		                        <f:selectItem itemValue="7" itemLabel="Julio" />
		                        <f:selectItem itemValue="8" itemLabel="Agosto" />
		                        <f:selectItem itemValue="9" itemLabel="Septiembre" />
		                        <f:selectItem itemValue="10" itemLabel="Octubre" />
		                        <f:selectItem itemValue="11" itemLabel="Noviembre" />
		                        <f:selectItem itemValue="12" itemLabel="Diciembre" />
							</h:selectOneMenu> &#160;
							<h:selectOneMenu id="anioId" value="#{receiptsBean.receiptYear}"  styleClass="campo_texto" >
								<f:ajax render="@none" execute="@this" />                        
		                        <f:selectItem itemValue="2010" itemLabel="2010" />
		                        <f:selectItem itemValue="2011" itemLabel="2011" />
		                        <f:selectItem itemValue="2012" itemLabel="2012" />
		                        <f:selectItem itemValue="2013" itemLabel="2013" />
		                        <f:selectItem itemValue="2014" itemLabel="2014" />
		                        <f:selectItem itemValue="2015" itemLabel="2015" />
		                        <f:selectItem itemValue="2016" itemLabel="2016" />
		                        <f:selectItem itemValue="2017" itemLabel="2017" />
		                        <f:selectItem itemValue="2018" itemLabel="2018" />
		                        <f:selectItem itemValue="2019" itemLabel="2019" />
		                        <f:selectItem itemValue="2020" itemLabel="2020" />
							</h:selectOneMenu>									
						</h:panelGroup>
					</h:panelGroup>	
																		
					<h:outputText value="Importe" />
					<h:inputText id="importeId" styleClass="columnanumero" value="#{receiptsBean.receiptsView.amount}"  onfocus="this.select();" onkeydown="return (numeric(event, 1) &amp;&amp; noPaste(event, this));" onkeyup="extractNumber(this,2,false);" />
					
					<h:outputText value="Condomino" />					
					<h:selectOneMenu id="condominoId" value="#{receiptsBean.receiptsView.condominiumsView.id}"  styleClass="campo_texto" >
	  						<f:selectItems value="#{receiptsBean.condominiumsList}" />
					</h:selectOneMenu>
					
					
					<h:outputText value="Tipo de Ingreso" />
					<h:selectOneMenu id="tipoIngresoId" value="#{receiptsBean.receiptsView.receiptsItemView.id}"  styleClass="campo_texto" >
	  						<f:selectItems value="#{receiptsBean.receiptsList}" />
					</h:selectOneMenu>
					
					<h:outputText value="Comentarios" />					
					<h:inputTextarea styleClass="campo_texto" value="#{receiptsBean.receiptsView.comments}"  onfocus="this.select();" cols="50" rows="10" />					
					
					<f:facet name="footer">
					    <h:panelGroup style="text-align:right">
					      <sec:submodulo modulo="INGRESOS" submodulo="ADD">					      
					      	<h:commandButton id="submit" styleClass="boton" value="Guardar" action="#{receiptsBean.insertReceipt}" />&#160;&#160;
					      	<h:commandButton id="submitandNew" styleClass="boton_large" value="Guardar y Nuevo" action="#{receiptsBean.goAddAndNewReceipts}" />&#160;&#160;
					      </sec:submodulo>
					      <h:commandButton id="back" styleClass="boton" value="Regresar" action="#{receiptsBean.backAction}" immediate="true" />	
					    </h:panelGroup>
					 </f:facet>
										
				</h:panelGrid>
				
			</h:form>
	</ui:define>
    
</ui:composition>